# 指定镜像
FROM guyton/centos6
# 指定系统管理员
MAINTAINER xiangsikai
# 安装编译库
RUN yum install -y gcc gcc-c++ gd-devel libxml2-devel libcurl-devel libjpeg-devel libpng-devel openssl-devel
# 下载压缩包解压到指定目录
ADD php-5.6.31.tar.gz /tmp/
# 编译安装php，执行相关命令
RUN cd /tmp/php-5.6.31 && \
    ./configure --prefix=/usr/local/php \
    --with-config-file-path=/usr/local/php/etc \
    --with-mysql --with-mysqli \
    --with-openssl --with-zlib --with-curl --with-gd \
    --with-jpeg-dir --with-png-dir --with-iconv \
    --enable-fpm --enable-zip --enable-mbstring && \
    make -j 4 && make install && \
    cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf && \
    sed -i "s/127.0.0.1/0.0.0.0/" /usr/local/php/etc/php-fpm.conf && \
    cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm && \
    chmod +x /etc/init.d/php-fpm 
# 复制本地配置文件到容器内
COPY php.ini /usr/local/php/etc
# 声明暴露端口
EXPOSE 9000
# 启动php
CMD /etc/init.d/php-fpm start && tail -F /var/log/messages
